package com.hna.eking.AirlineServer.Platform.Common;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 
 *  视图控制类
 * <p>Date : 2013-4-17</p>
 * <p>Module : </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright &copy; 2013</p>
 * <p>Company :neusoft</p>
 * 
 * @author , BD&PRC
 * @version  V1.0
 * <p>------------------------------------------------------------</p>
 * <p> 修改历史</p>
 * <p> 序号 日期 修改人 修改原因</p>
 * <p> 1 </p>
 */
@Controller
//@RequestMapping("/MapView/*")
public class ViewsController {
	
	private static final Logger logger = LoggerFactory.getLogger(ViewsController.class);	
//    @ResponseBody
//    @RequestMapping("globalStatistics")
//    public Model globalStatistics(HttpServletRequest request,Model model) {
//    	String ip = request.getHeader("x-forwarded-for");
//    	if(ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")){
//    		ip= request.getHeader("Proxy-Client-IP");
//    	}
//		if(ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")){
//			ip= request.getHeader("WL-Proxy-Client-IP");		
//		}
//		if(ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")){
//			ip= request.getRemoteAddr();
//		}
//		model.addAttribute("ip", ip);
//		return model;
//    }
//    
//  
//    @RequestMapping("TestOpenLayer")
//    public String UpLoadImageCtl(HttpServletRequest request,Model model) {
//    	
//		return "TestOpenLayer";
//    } 
//    
//    @RequestMapping("MapDemo")
//    public String MapDemo(HttpServletRequest request,Model model) {
//    	
//		return "MapDemo";
//    } 
//    
//    @RequestMapping("ChinaMap")
//    public String ChinaMap(HttpServletRequest request,Model model) {
//    	
//		return "ChinaMap";
//    } 
//    
//    @RequestMapping("ChinaMobile")
//    public String ChinaMobile(HttpServletRequest request,Model model) {
//    	
//		return "ChinaMobile";
//    } 
//    
//    @RequestMapping("ChinaMap2")
//    public String ChinaMap2(HttpServletRequest request,Model model) {
//    	
//		return "ChinaMap2";
//    } 
	@RequestMapping("/MapView/*")
	public String ChinaMap2(HttpServletRequest request,Model model) {
//		logger.error(request.getMethod());
//		logger.error(request.getLocalAddr());
		logger.error(request.getServletPath() );
		logger.debug(request.getRequestURI());
		String ReqURI = request.getRequestURI();
		return ReqURI.split("/")[2];
    }
	
    @RequestMapping("/hello")
    public String hello() {
 //   	 map.put("index","index");//这句话无关,应该是放返回值用的
        return "hello";	//自动转化为html视图
    }
    
	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public String userLogin(HttpServletRequest request) {
		return "login";
	}
	
	@RequestMapping(value = "/index", method = RequestMethod.GET)
	public String index(HttpServletRequest request) {
		return "index";
	}
}
